Learn R Programming

sbioPN (version 1.1.0)

b) Simulation Functions: Simulation of a biochemical system with spatial effects

Description

These functions simulate a biochemical reacton system with spatial effects parameterized as a Petri Net. sGillespieOptimDirect and sGillespieDirectCR performs pure stochastic simulations, sRungeKuttaDormandPrince45 a pure deterministic integration, sHaseltineRawlings a hybrid of the above. Multiple runs can be performed at once.

See init for a way of defining the model that is close to the way reactions are written.

Usage

## Exact stochastic simulation: sGillespieOptimDirect(model, timep, delta=1, runs=1) sGillespieDirectCR(model, timep, delta=1, runs=1)
## Pure deterministic: sRungeKuttaDormandPrince45(model, timep, delta=1, ect = 1e-09)
## Hybrid stochastic/deterministic: sHaseltineRawlings(model, timep, delta=1, runs=1, ect = 1e-09)

Arguments

model
list containing named elements:
timep
It can be either a numeric, indicating for how long (in the same time units as the propensity constants) the process will run, or a functions (R or C), in which case can be used to change the protocol at time intervals. See details.
delta
Interval time at which the state will be saved.
runs
How many runs will be performed.
ect
Precision for the fast reactions.

Value

The functions return a list with the following elements:
place
vector with the names of the places if supplied. If not, the function creates names as follows: P1, P2, ...
transition
vector with the names of the transitions if supplied. If not, the function creates names as follows: T1, T2, ...
dt
vector containing the discretized times at which the state is saved (according to delta)
run
list with as many elements as runs. We will describe the first element, run[[1]], as the rest have exactly the same structure. It is also a list, with the following elements:
run[[1]]$M
list with as many elements as places, each of them containing the state of the system sampled according to delta.
run[[1]]$transitions
vector with as many elements as transitions, with the total of time each slow reaction fired.
run[[1]]$tot.transitions
numeric with the summ of run[[1]]$transitions.

Details

model is a list containing the following elements:
  • model$pre: pre matrix, with as many rows as transitions (reactions), and columns as places (reactants). It has the stoichiometrics of the left sides of the reactions.
  • model$post: post matrix, with as many rows as transitions, and columns as places (products). It has the stoichiometrics of the right sides of the reactions.
  • model$h: list of propensity constants or functions returning the propensity (with as many elements as transitions).
  • model$slow: vector of zeros for slow transitions and ones for fast transitions. Only needed for HaseltineRawlings. Ignored otherwise.
  • model$M: initial marking (state) of the system.
  • model$place: vector with names of the places.
  • model$transition: vector with names of the transitions.

See Also

init, atr

Examples

Run this code
## sbioPN has been tested only on 64 bits machines.
## It may fail in 32 bits architecture.

Run the code above in your browser using DataLab